﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;

namespace ThessalonikiGuide
{
    public partial class Privacy : PhoneApplicationPage
    {
        public Privacy()
        {
            InitializeComponent();
            try
            {
                check.IsChecked = IsolatedStorageSettings.ApplicationSettings["canuselocation"] as bool? == true;
            }
            catch (KeyNotFoundException)
            {
                IsolatedStorageSettings.ApplicationSettings["canuselocation"] = true;
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            try
            {
                if (NavigationContext.QueryString["red"] == "1")
                {
                    NavigationService.RemoveBackEntry();
                    NavigationService.RemoveBackEntry();
                }
            }
            catch (KeyNotFoundException) { }
            base.OnNavigatedTo(e);
        }
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            try
            {
                IsolatedStorageSettings.ApplicationSettings["canuselocation"] = check.IsChecked.Value;
            }
            catch (NullReferenceException) { }
        }
    }
}